import {Injectable} from '@angular/core';
import {HttpClient, HttpParams} from '@angular/common/http';
import {UrlService} from '../common/service/url.service';
import {SearchResult} from '../content/model/search-result';
import {Observable} from 'rxjs';
import {ApiRes} from '../common/model/response';

@Injectable({
  providedIn: 'root'
})
export class NewPolicyDetailService {

  constructor(private http: HttpClient,
              private urlService: UrlService) {
  }

  getNewPolicyDetail(id: number): Observable<ApiRes> {
    const params = new HttpParams().append('id', id.toString());
    const url = this.urlService.getUrl('/newPolicy/getById');
    return this.http.get<ApiRes>(url, {params});

  }

  getRelatedPolicyDetail(id: number): Observable<ApiRes> {
    const params = new HttpParams().append('id', id.toString());
    const url = this.urlService.getWebUrl('/policySearch/details');
    return this.http.get<ApiRes>(url, {params});

  }

}
